<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas id="canvas"></canvas>
</body>
<script>
    let x = 0;
    function draw(){
        window.requestAnimationFrame(draw)
        let canvas = document.getElementById("canvas");
        let ctx = canvas.getContext("2d");
        ctx.clearRect(0,0,canvas.width,canvas.height);
        ctx.fillStyle = "red";
        ctx.fillRect(x,100,200,100);
        x += 1;
    }
    window.requestAnimationFrame(draw);
</script>
</html>